package com.shuai.user.controller;

import com.shuai.clientsdk.exc.OpenAPIException;
import com.shuai.common.constant.AuthenticationConstant;
import com.shuai.user.domain.request.OnLineInvokeRequest;
import com.shuai.user.service.OnlineInvokeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/online_invoke")
public class OnlineInvokeController {

    @Autowired
    private OnlineInvokeService onlineInvokeService;


    @PostMapping("/m2")
    public String onlineInvokeTestM2(@RequestBody OnLineInvokeRequest invokeRequest,
                                     @RequestHeader(AuthenticationConstant.AUTHENTICATION_HEADER) String authentication) throws OpenAPIException {
        onlineInvokeService.validatorParams(invokeRequest);
        return (String) onlineInvokeService.onlineInvoke(authentication, invokeRequest);
    }
}
